<%--
  Created by IntelliJ IDEA.
  User: 刘岱骞
  Date: 2025/6/16
  Time: 11:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
  <title>Title</title>
  <link rel="stylesheet" href="/layui/css/layui.css">
  <script src="/layui/layui.js"></script>
  <script src="/layui/jquery-3.6.0.min.js"></script>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    }

    body {
      background: linear-gradient(135deg, #f5f8fa 0%, #e6f0f5 100%);
      color: #333;
      min-height: 100vh;
      padding: 20px;
    }

    .header {
      background: linear-gradient(120deg, #1e88e5, #0d47a1);
      color: white;
      border-radius: 12px;
      padding: 25px 30px;
      margin-bottom: 30px;
      box-shadow: 0 8px 20px rgba(13, 71, 161, 0.25);
      position: relative;
      overflow: hidden;
      text-align: center;
    }

    .header::before {
      content: '';
      position: absolute;
      top: -50%;
      left: -50%;
      width: 200%;
      height: 200%;
      background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
      transform: rotate(30deg);
    }

    .header h1 {
      font-size: 36px;
      font-weight: 700;
      margin-bottom: 10px;
      position: relative;
    }

    .header p {
      font-size: 18px;
      opacity: 0.9;
      max-width: 800px;
      margin: 0 auto;
      position: relative;
    }

    .container {
      max-width: 1200px;
      margin: 0 auto;
    }

    .video-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      gap: 25px;
      margin-bottom: 40px;
    }

    .video-card {
      background: white;
      border-radius: 12px;
      overflow: hidden;
      box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
      transition: all 0.3s ease;
      position: relative;
    }

    .video-card:hover {
      transform: translateY(-10px);
      box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
    }

    .video-thumb {
      height: 180px;
      position: relative;
      overflow: hidden;
    }

    .video-thumb img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      transition: transform 0.5s ease;
    }

    .video-card:hover .video-thumb img {
      transform: scale(1.05);
    }

    .video-thumb .play-icon {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 60px;
      height: 60px;
      background: rgba(255, 255, 255, 0.8);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0.9;
      transition: all 0.3s ease;
    }

    .video-card:hover .play-icon {
      background: rgba(30, 136, 229, 0.9);
      opacity: 1;
    }

    .video-thumb .play-icon i {
      font-size: 30px;
      color: #1e88e5;
    }

    .video-card:hover .play-icon i {
      color: white;
    }

    .video-info {
      padding: 20px;
    }

    .course-name {
      font-size: 18px;
      font-weight: 700;
      color: #0d47a1;
      margin-bottom: 8px;
      display: flex;
      align-items: center;
    }

    .course-name i {
      margin-right: 8px;
    }

    .video-title {
      font-size: 16px;
      font-weight: 600;
      margin-bottom: 15px;
      height: 48px;
      overflow: hidden;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
    }

    .upload-time {
      display: flex;
      align-items: center;
      color: #666;
      font-size: 14px;
      border-top: 1px solid #eee;
      padding-top: 15px;
      margin-top: 15px;
    }

    .upload-time i {
      margin-right: 8px;
      color: #1e88e5;
    }

    .controls {
      display: flex;
      justify-content: center;
      margin-bottom: 40px;
    }

    .filter-btn {
      background: linear-gradient(120deg, #1e88e5, #0d47a1);
      color: white;
      border: none;
      padding: 12px 30px;
      border-radius: 30px;
      cursor: pointer;
      font-weight: 600;
      font-size: 16px;
      transition: all 0.3s ease;
      box-shadow: 0 4px 15px rgba(13, 71, 161, 0.3);
      display: flex;
      align-items: center;
    }

    .filter-btn i {
      margin-right: 8px;
    }

    .filter-btn:hover {
      transform: translateY(-3px);
      box-shadow: 0 6px 20px rgba(13, 71, 161, 0.4);
    }

    .footer {
      text-align: center;
      color: #666;
      padding: 20px;
      font-size: 14px;
      margin-top: 20px;
    }

    @media (max-width: 768px) {
      .video-grid {
        grid-template-columns: 1fr;
        max-width: 500px;
        margin: 0 auto;
      }

      .header h1 {
        font-size: 28px;
      }

      .header p {
        font-size: 16px;
      }
    }
  </style>
  <script>
    $(function () {
      layui.use(['laypage', 'layer'], function () {
        var laypage = layui.laypage
                , layer = layui.layer;
        //分组件
        laypage.render({
          elem: 'pagesData'
          , count: ${pageInfo.total}
          , layout: ['count', 'prev', 'page', 'next',  'skip']
          , limit: ${pageInfo.pageSize}
          , limits: [5, 10]
          , curr:${pageInfo.pageNum}
          , jump: function (obj,first) {
            //首次不执行
            if(!first){
              if (obj.curr !=${pageInfo.pageNum}) {
                location.href = "/videoStu/findAll?page=" + obj.curr + "&limit=" + obj.limit+"&courseName="+$("#key").val()
              }else if(obj.limit!=${pageInfo.pageSize}){
                location.href = "/videoStu/findAll?page=1&limit=" + obj.limit+"&courseName="+$("#key").val()
              }
            }

          }
        });

        // 卡片点击事件
        document.querySelectorAll('.video-card').forEach(card => {
          card.addEventListener('click', function() {
            const url=$(this).attr("url");
            console.log($(this).attr("url"));
            layer.open({
              type: 1, // page 层类型
              area: ['800px', '480px'],
              title: false, // 不显示标题栏
              closeBtn: 0,
              offset: 'lt',
              shade: 0.6, // 遮罩透明度
              shadeClose: true, // 点击遮罩区域，关闭弹层
              //maxmin: true, // 允许全屏最小化

              anim: 0, // 0-6 的动画形式，-1 不开启
              content: '<video width="100%"  height ="100%" src=/videoPlay/'+url+' autoplay controls></video>',
              end: function(){
                console.log('弹层已被移除');

              }
            });
          });
        });

      });




    })

  </script>


</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>视频列表</legend>
</fieldset>
<div class="layui-bg-gray" style="padding: 0px;">
  <div class="layui-row layui-col-space15">
    <form action="/videoStu/findAll">
      <div class="layui-input-inline" style="width:300px;">
        <input type="text" id="key" name="courseName"  value="${value}" class="layui-input" placeholder="根据课程名称或视频标题模糊查询">
      </div>&nbsp; &nbsp;&nbsp; &nbsp;
      <button  class="layui-btn layui-btn-sm">
        <i class="layui-icon layui-icon-search"></i>查询
      </button>
    </form>
    <div class="video-grid">
      <c:forEach items="${pageInfo.list}" var="video">
        <!-- 视频卡片1 -->
        <div class="video-card" url="${video.videoUrl}">
          <div class="video-thumb">
            <img src="https://images.unsplash.com/photo-1552664730-d307ca884978?ixlib=rb-1.2.1&auto=format&fit=crop&w=600&q=80" alt="Web开发课程">
            <div class="play-icon">
              <i class="layui-icon layui-icon-play"></i>
            </div>
          </div>
          <div class="video-info">
            <div class="course-name">
              <i class="layui-icon layui-icon-app"></i> ${video.courseName}
            </div>
            <div class="video-title">
                ${video.title}
            </div>
            <div class="upload-time">
              <i class="layui-icon layui-icon-date"></i> 上传时间: ${video.getCreatedTimeStr() }
            </div>
          </div>
        </div>
      </c:forEach>
    </div>
    <!--分页-->
    <div id="pagesData"></div>
  </div>
</div>
</div>
</body>

<script>
  //取消选中并且取消右键操作
  document.body.onselectstart =
          document.body.oncontextmenu =
                  function () {
                    return false; //取消浏览器默认操作
                  };
</script>
</html>
